<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="frmTpComponente">
		<h:panelGroup id="pnGroupComponente">
			<h:panelGrid columns="9" id="gridTpComponente">
				<p:outputLabel value="Nome do Tipo de Componente: " for="campo_nmTpComponente" />
				<p:inputText value="#{tpItemMB.tpComponente.nmTpComponente}" id="campo_nmTpComponente" readonly="#{tpItemMB.bTpComponente}" />

				<p:outputLabel value="Valido" />
				<p:selectBooleanCheckbox value="#{tpItemMB.tpComponente.valido}" disabled="#{tpItemMB.bTpComponente}" />

				<p:outputLabel value="Obrigatório" />
				<p:selectBooleanCheckbox value="#{tpItemMB.tpComponente.obrigatorio}" disabled="#{tpItemMB.bTpComponente}" />

				<p:commandButton value="Adicionar" disabled="#{tpItemMB.bTpComponente}">
					<f:ajax event="click" listener="#{tpItemMB.addTpComponente}" execute="gridTpComponente" render=":tpItem"></f:ajax>
				</p:commandButton>
				
				<p:commandButton value="Novo" disabled="#{tpItemMB.bNewTpComponente}">
					<f:ajax event="click" listener="#{tpItemMB.addNewTpComponente}" execute="gridTpComponente" render=":tpItem"></f:ajax>
				</p:commandButton>
			</h:panelGrid>
			<br />

			<p:dataTable value="#{tpItemMB.lTpComponente}" var="c" border="1" bgcolor="White" cellpadding="10" id="tbComponente"
				selectionMode="single" rowKey="#{c.nmTpComponente}">

				<p:ajax listener="#{tpItemMB.onRowSelectTpComponente}" event="rowSelect" update="@all"/>
				
				<f:facet name="header">Lista de Tipos de Componentes</f:facet>
				
				<p:column>
					<f:facet name="header">Nome</f:facet>
				#{c.nmTpComponente}
 				</p:column>

				<p:column>
					<f:facet name="header">Valido</f:facet>
 				#{c.valido}
 				</p:column>

				<p:column>
					<f:facet name="header">Obrigatório</f:facet>
 				#{c.obrigatorio}
 				</p:column>
			</p:dataTable>
			<br />
			<br />
			<br />
		</h:panelGroup>

			<h:panelGroup id="pnGroupDetalhe">
			<h:panelGrid columns="8" id="gridTpDetalhe">
				<p:outputLabel value="Nome do Tipo de Detalhe: " for="campo_nmTpDetalhe" />
				<p:inputText value="#{tpItemMB.tpDetalhe.nmDetalhe}" id="campo_nmTpDetalhe"  readonly="#{tpItemMB.bTpDetalhe}"/>

				<p:outputLabel value="Valido" />
				<p:selectBooleanCheckbox value="#{tpItemMB.tpDetalhe.valido}" disabled="#{tpItemMB.bTpDetalhe}" />

				<p:outputLabel value="Obrigatório" />
				<p:selectBooleanCheckbox value="#{tpItemMB.tpDetalhe.obrigatorio}" disabled="#{tpItemMB.bTpDetalhe}" />

				<p:commandButton value="Adicionar" disabled="#{tpItemMB.bTpDetalhe}">
					<f:ajax event="click" listener="#{tpItemMB.addTpDetalhe}" execute="gridTpDetalhe" render=":tpItem"></f:ajax>
				</p:commandButton>
			</h:panelGrid>
			<br />

			<p:dataTable value="#{tpItemMB.tpComponente.tpDetalhes}" var="d"
				border="1" bgcolor="White" cellpadding="10" id="tbDetalhe" >

				<f:facet name="header">Lista de Tipos de Detalhes</f:facet>

				<p:column>
					<f:facet name="header">Nome</f:facet>
				#{d.nmDetalhe}
			</p:column>

				<p:column>
					<f:facet name="header">Valido</f:facet>
 				#{d.valido}
 			</p:column>

				<p:column>
					<f:facet name="header">Obrigatório</f:facet>
 				#{d.obrigatorio}
 			</p:column>
			</p:dataTable>
		</h:panelGroup>
			<br />
			<br />
			<br />
	</h:form>

</ui:composition>